package cn.xcyy.itcc.controller;

import cn.xcyy.itcc.doc.CourseDoc;
import cn.xcyy.itcc.dto.CourseSearchDto;
import cn.xcyy.itcc.result.JSONResult;
import cn.xcyy.itcc.service.ISearchServicce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private ISearchServicce searchServicce;

    @RequestMapping(value="/courseEsAdd",method= RequestMethod.POST)
    public JSONResult courseEsAdd(@RequestBody CourseDoc courseDoc){
        searchServicce.courseEsAdd(courseDoc);
        return JSONResult.success();
    }
    /*
     * @Description: ES搜索
     * @param courseSearchDto: ES搜索条件对象
     **/
    @RequestMapping(value = "/course/search",method = RequestMethod.POST)
    public JSONResult search(@RequestBody CourseSearchDto courseSearchDto){
        return JSONResult.success(searchServicce.search(courseSearchDto));
    }

}
